package com.tyy.springbootmysql.controller;

import com.tyy.springbootmysql.entity.UserInfo;
import com.tyy.springbootmysql.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserInfoController {
    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/{id}")
    public UserInfo getUserInfo(@PathVariable("id") Long id) {
        return userInfoService.getUserInfo(id);
    }
    @PostMapping("/update")
    public void updateUserInfo(@RequestBody UserInfo userInfo) {
        // userInfoService.saveUserInfo(userInfo);
        userInfoService.updateUserInfo(userInfo);
    }
}
